<?php
    require_once '../frm/init.php';
    require_once '../clases/Registrado.php';
    require_once 'includes/inc_session.php';

    Ftl_Header::setCharsetEncoding();
    Ftl_Header::setNoCache();
    
    switch ($ioHelper->get('action'))
    {
        case 'edit':
            $params     = Ftl_ArrayUtil::toQueryString($_REQUEST, false,'action,id');
            $urlEdit    = 'registrados-am.php?id='.$ioHelper->get('id').($params ? '&params='.rawurlencode($params) : '');
            Ftl_Redirect::toPage($urlEdit);
            break;
        case 'changeStatus':
            Ftl_Registrado::cambiarEstado($ioHelper->get('id'), $ioHelper->get('status'));
            break;
        case 'mg':
            
            $id         = $ioHelper->get('id',0);
            $guid       = $ioHelper->get('encrypt',0);
            $reg        = new Registrado($id,$guid);

            if ($reg->getId() > 0)
                    $reg->marcarComoGanador (2);

            $reg = null;
            Ftl_Redirect::toPage(Ftl_Path::getFileName() . '?' . Ftl_ArrayUtil::toQueryString($ioHelper->getAll(), true, 'action,id,encrypt',false));
            break;
    }

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Usuarios</title>
<script src="../js/jquery.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript" src="../js/JS.js"></script>

<link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" title="default" />
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" media="all" />
<!--[if IE]>
<link rel="stylesheet" media="all" type="text/css" href="css/pro_dropline_ie.css" />
<![endif]-->

<!-- Custom jquery scripts -->
<script src="js/jquery/custom_jquery.js" type="text/javascript"></script>

<script src="js/jquery/jquery.pngFix.pack.js" type="text/javascript"></script>
<script type="text/javascript">
    JS.cargarModulos('../js','UI');
    $(document).ready(function(){
        $(document).pngFix( );
    });
</script>

</head>
<body>

    <?php include ('includes/inc_nav.php');?>


<div id="content-outer">
<!-- start content -->
<div id="content">

	<!--  start page-heading -->
	<div id="page-heading">
		<h1><?php echo $titulo;?></h1>
	</div>
	<!-- end page-heading -->

	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td>
		<!--  start content-table-inner ...................................................................... START -->
		<div id="content-table-inner">

			<!--  start table-content  -->
			<div id="table-content">

                                <?php

                                    $opciones = array (

                                        'fields'        => array (
                                            'nro_doc'   => array('title'=>'DNI','type'=>'text','filter'=>true),
                                            'nombre'    => array('title'=>'Nombre','type'=>'text','filter'=>true),
                                            'apellido'  => array('title'=>'Apellido'),
                                            'sexo'      => array('title'=>'Sexo','type'=>'gender','filter'=>true),
                                            'estado'    => array('title'=>'Estado','type'=>'state','data'=>array('0' => 'Sin moderar','1'=>'Aprobado')),
                                            'chances'  => array('title'=>'Chances'),
                                            'fecha_alta'=> array('title'=>'Fecha de alta','type'=>'date','format'=>'Y-m-d','filter'=>true)

                                        ),
                                        'canOrder'      => false,
                                        'orderBy'       => 'id|DESC',
                                        
                                        'showActions'   => true,
                                        'canEdit'       => false,
                                        'canDelete'     => false,
                                        'canChangeStatus' => true,

                                        'extendedActions'   => array (

                                            'mg' => array ('title'=>'Marcar como ganador de la promo','ui_icon' => 'ui-icon-star','url' => 'registrados.php')

                                        ),
                                        'resPerPage'     => 100

                                    );


                                    $list = new Ftl_ListBO( $opciones );



                                    $usuarios = Ftl_Registrado::obtenerListado($list->getCurrentPage(),$list->getResPerPage(),$list->getFiltersForSql(),$list->getOrderByForSql());

                                    $list->show($usuarios);

                                ?>

				
			</div>


		</div>
		<!--  end content-table-inner ............................................END  -->
		</td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
	

</div>
<!--  end content -->

</div>
<!--  end content-outer........................................................END -->




</body>
</html>